package com.feicheng.lanniao.controller.pc;

import com.feicheng.lanniao.anno.StaticSelectCountOfCarBuyInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.feicheng.lanniao.entity.CarBuyInfo;
import com.feicheng.lanniao.result.ResultInfo;
import com.feicheng.lanniao.service.ICarBuyClientVoService;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author feichengTech
 * @since 2021-09-07
 */
@RestController
@RequestMapping("/lanniao-user/car-buy-vo")
public class CarBuyInfoClientPcController {

	@Autowired
	ICarBuyClientVoService iCarBuyClientVoService;

	@GetMapping("/page")
	public ResultInfo getCarBuyClientVoList(String title, String details,Integer clientId,
			@RequestParam(required = false, defaultValue = "1") Integer currentPage,
			@RequestParam(required = false, defaultValue = "5") Integer pageSize) {
		return iCarBuyClientVoService.getCarBuyClientVoList(title, details,clientId, currentPage, pageSize);
	}

	@DeleteMapping("/info")
	public ResultInfo deleteBuyCar(Integer cbId) {
		return iCarBuyClientVoService.deleteCarBuyInfo(cbId);
	}

	@GetMapping("/info")
	public ResultInfo getOneCb(Integer cbId) {
		return iCarBuyClientVoService.getOneCarBuyInfo(cbId);
	}
	@PutMapping("/info")
	public ResultInfo editCb(CarBuyInfo carBuyInfo) {
		return iCarBuyClientVoService.editOneCarBuyInfo(carBuyInfo);
	}
	@PostMapping("/info")
	public ResultInfo saveOneCb(String tel,String wxNumber,String title,String details,Integer clientId) {
		return iCarBuyClientVoService.insertOneCarInfo(tel,wxNumber,title,details,clientId);
	}

}
